
<!DOCTYPE html>
<html lang="cn">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="chapter" content="fi">

    <!-- For Facebook Sharing -->
    <meta property="og:url" content="http://students.brown.edu/seeing-theory/frequentist-inference/" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="统计推断：频率学派" />
    <meta property="og:description" content="频率学派通过观察数据来确定背后的概率分布。" />
    <meta property="og:image" content="http://students.brown.edu/seeing-theory/img/share/4.png" />
    <meta property="og:image:width" content="1200" />
    <meta property="og:image:height" content="630" />


    <title>看见统计 - 统计推断：频率学派</title>
    <!-- CSS Imports -->
    <!--Fonts-->
    <link href="https://fonts.googleapis.com/css?family=Assistant:300,400,600,700" rel="stylesheet">
    <!--Font Awesome-->
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <!--Favicon-->
    <link rel="shortcut icon" type="image/png" href="../img/favicon.png" />
    <!-- General Chapter -->
    <link rel="stylesheet" type="text/css" href="../css/chapter-style.css">
    <!-- Specific Chapter -->
    <link rel="stylesheet" type="text/css" href="frequentist-inference.css">
    <!-- JavaScript Imports -->
    <!-- D3 -->
    <script src="../js/d3.min.js"></script>
    <!-- Jquery -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    <!-- jstat -->
    <script src="../js/jstat.min.js"></script>
    <!-- MathJax -->
    <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML"></script>
    <!-- Tool Tip -->
    <script src="../js/d3.tip.v0.6.3.js"></script>
    <!-- General Chapter -->
    <script src="../js/chapter.js"></script>
    <!-- Visualizations -->
    <script src="frequentist-inference.js"></script>
    <!-- Google Analytics -->
    <script>
    (function(i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function() {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
            m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
    ga('create', 'UA-85617614-1', 'auto');
    ga('send', 'pageview');
    </script>
</head>

<body id='1'>
    <div id="share-modal"></div>
    <div class="header">
        <div class="progress-bar">
            <div class="progress-bar-color"></div>
        </div>
        <div class="header-wrapper">
            <ul class="chapter-nav">
                <li>
                    <span onclick="openNav()" id="hamburger">&#9776; </span>
                </li>
                <li><a href="../cn.html" id="seeing-theory">看见统计</a></li>
                <li><a onclick='toTop()' id='display-chapter'>第四章: 统计推断：频率学派</a></li>
            </ul>
        </div>
    </div>
    <div class="col-left">
        <div class="col-left-wrapper">
            <div id="section0">
                <div class="chapter-intro">
                    <h4>第四章</h4>
                    <h1>统计推断：频率学派</h1>
                    <p>频率学派通过观察数据来确定背后的概率分布。
                    </p>
                </div>
                <div class="scroll-down"> <img src="../img/button/bottom-arrow.svg"></div>
            </div>
            <div id="section1">
                <div class="unit">
                    <h3>点估计</h3>
                    <p>统计学中一个主要的问题是估计参数。我们用一个取值为样本的函数来估计我们感兴趣的参数，并称这个函数为估计量。这里我们用一个估计圆周率\(\pi\)的例子来具体说明这个想法。
                    我们知道\(\pi\)可以由圆与其外切正方形的面积比来表示：
                    <span id="mathjax_4_1">$$\begin{matrix}S_{circle} = \pi r^2\\S_{square} = 4r^2\end{matrix} \implies \pi = 4 \frac{S_{circle}}{S_{square}}$$</span>
                    首先我们均匀地在正方形上随机生成\(n\)个样本，用\(m\)来表示落入这个正方形内切圆的样本个数。定义估计量\(\hat{\pi}\)如下：
                        $$\hat{\pi} = 4\dfrac{m}{n}$$
                    我们可以看到这个估计量有良好的性质：<em>无偏性  </em>和<em>相合性</em>。</p>
                    <div class="interactive-wrapper">
                    <table id="estimation" class="table table-bordered">
                      
                        <colgroup></colgroup>
                        <colgroup></colgroup>
                        <tbody>
                            <tr>
                                
                                <td>
                                    \( m= \) <span id="m">0.00</span><br>
                                    \( n= \) <span id="n">0.00</span>
                                </td>
                                <td>\( \hat{\pi}= \) <span id="pi"></span></td>
                            </tr>
                        </tbody>
                    </table>         
                    <div class="button-1" id="dropHundred">生成100个样本</div>
                    <div class="button-1" id="dropThousand">生成1000个样本</div>
                </div></div>
            </div>
            <div id="section2">
                <div class="unit">
                    <h3>置信区间</h3>
                    <p>与点估计不同，置信区间用估计的是一个参数的范围。一个置信区间对应着一个置信水平：一个置信水平为\(95\%\)的置信区间表示这个置信区间包含了真实参数的概率为\(95\%\)。</p>
                    <p> 你可以选择一个概率分布来生成样本</p>
                    <div class="interactive-wrapper">
                    <select id="dist_ci" class="st-dropdown">
                        <option disabled selected> -- 选择概率分布 -- </option>
                        <option value="uniform">均匀分布 Uniform</option>
                        <option value="normal">正态分布 Normal</option>
                        <option value="studentt">学生t分布 Student T</option>
                        <option value="chisquare">卡方分布 Chi Squared</option>
                        <option value="exponential">指数分布 Exponential</option>
                        <option value="centralF">F分布 Fisher–Snedecor</option>
                    </select></div>
                    <p> 选择样本大小\(n\)和置信水平 \((1-\alpha)\)。</p>
                    <div class="interactive-wrapper">
                        <div class="left-align-wrapper" >
                        <label for="samplesize" class="slider">
                            \(n\) = <span id="samplesize-value">5</span>
                        </label>
                        <input id="samplesize" class="blueSlider" type="range" min="3" max="30" step="1" value="5">
                        <br>
                        <label for="alpha" class="slider">
                             \(1-\alpha\) = <span id="alpha-value">0.90</span>
                        </label>
                        <input id="alpha" class="blueSlider" type="range" min="0.01" max="0.99" step="0.01" value="0.9">
                        </div>
                    </div>
                    <p> 开始生成样本和构造置信区间。</p>
                    <div class="interactive-wrapper">
                    <div id="ciDist"></div>
                    <div class="button-1 sample_btn"  id="startCI">开始生成样本</div>
                    <div class="button-1 sample_btn"  id="stopCI" style="display:none">停止生成样本</div>

                </div>
                 <p>图形展示改编自 Kristoffer Magnusson的 <a href="http://rpsychologist.com/d3/CI/">置信区间</a>.</p>

                </div>
            </div>
            <div id="section3">
                <div class="unit">
                    <h3>Bootstrap方法</h3>
                    <p>许多频率学派的统计推断侧重于使用一些“性质比较良好”的估计量。但是我们知道这些统计量本身是样本的函数，因此往往比较难分析它们自己的概率分布。而Bootstrap方法则给我们提供了一种方便的近似确定估计量性质的方法。下面我们通过一个例子来说明Bootstrap方法。假设我们现在有\(n\)个独立的样本\(X_1,...,X_n\)，基于这些样本我们就有了一个经验分布函数：</p>

                    <p>$$F_n(x) = \sum^n_{i=1}\mathbf{1}_{\{X_i\leq x\}}$$</p>

                    <p>我们可以重复根据这个经验分布函数生成样本，利用这些新的样本来估计元样本均值的标准差。</p>
                    <p> 你可以选择一个概率分布，然后生成一组样本和相应的经验分布函数。</p></li>
                    <div class="interactive-wrapper">
                    <select id="dist" class="st-dropdown">
                        <option disabled selected> -- 选择概率分布 -- </option>
                        <option value="uniform">均匀分布 Uniform</option>
                        <option value="normal">正态分布 Normal</option>
                        <option value="studentt">学生t分布 Student T</option>
                        <option value="chisquare">卡方分布 Chi Squared</option>
                        <option value="exponential">指数分布 Exponential</option>
                        <option value="centralF">F分布 Fisher–Snedecor</option>
                    </select>
                    </div>
                    <p> 选择抽样（以及重抽样）的样本大小然后根据你所选择的概率分布生成样本。</p>
                    <div class="interactive-wrapper">
                    <label for="sample_size" class="slider">
                        \(n\) = <span id="sample_size-value">10</span>
                    </label>
                    <input id="sample_size" class="blueSlider" type="range" min="3" max="20" step="1" value="10">
                    <div class="button-1"  id="sample">生成样本</div></div>

                    <p> 根据经验分布重抽样来估计样本均值的分散程度。</p>
                    <div class="interactive-wrapper">
                    <div class="button-1"  id="resample">重抽样</div>
                    <div class="button-1"  id="resample_100">重抽样100次</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="action-buttons">
            <ul>
                <a href="../doc/frequentist-inference.pdf">
                    <li><i class="fa fa-file-text-o action-icon" aria-hidden="true"></i> <span>下载英文PDF</span></li>
                </a>
                <a id="share-button" class="inline-share">

                    <li><i class="fa fa-share-square-o action-icon" aria-hidden="true"></i>分享</li>
                    <li><div id="share" data-sites="weibo,qq,douban,wechat, facebook, twitter, google,linkedin"></div></li>
                    <li><div id="share-modal"></div></li>

                </a>
            </ul>
        </div>
        <a href="../bayesian-inference/cn.html">
            <div class="chapter-footer" id="next-chapter-color">
                <div class="chapter-footer-wrapper">
                    <h4>下一章</h4>
                    <p id='next-chapter'>统计推断：贝叶斯学派 → </p>
                </div>
            </div>
        </a>
    </div>
    <div class="col-right">
        <div class='language-setting'>
            <select class="languageSetting">
                <option selected>中文</option>
                <option data-url="index.html">English</option>
                <option data-url="es.html">Español</option>
            </select>
        </div>
        <div class="nav-section" id="section-0">
            <div class="nav-unit-wrapper" id='one'>
                <img src="../img/tiles/4-1.png">
                <span class="nav-unit-title"> 点估计 </span>
            </div>
            <div class="nav-unit-wrapper" id='two'>
                <img src="../img/tiles/4-2.png">
                <span class="nav-unit-title"> 置信区间 </span>
            </div>
            <div class="nav-unit-wrapper" id='three'>
                <img src="../img/tiles/4-3.png">
                <span class="nav-unit-title"> Bootstrap方法 </span>
            </div>
        </div>
        <div class="visualization-section" id="section-1">
            <div class="visualization-wrapper" id="estSvg"></div>
        </div>
        <div class="visualization-section" id="section-2">
            <div class="visualization-wrapper" id="svg_ci"></div>
        </div>
        <div class="visualization-section" id="section-3">
            <div class="visualization-wrapper" id="bootstrapping"></div>
        </div>
    </div>
    <div id="overlay">
        <div class="modal-header">
            <div class="closebtn" onclick="closeNav()">&times;</div>
            <ul>
                <li>
                    <select class="languageSetting">
                        <option selected>中文</option>
                        <option data-url="index.html">English</option>
                        <option data-url="es.html">Español</option>
                    </select>
                </li>
                <li><a href="../cn.html">首页</a></li>
            </ul>
        </div>
        <div class="modal-wrapper">
            <div class="modal-chapter">
                <div id="chapter-text"><span>CHAPTER</span></div>
                <ul class="modal-chapter-titles">
                    <li id="bp-li" >基础概率论</li>
                    <li id="cp-li">进阶概率论</li>
                    <li id="pd-li">概率分布</li>
                    <li id="fi-li" class="chapter-highlighted">统计推断：频率学派</li>
                    <li id="bi-li">统计推断：贝叶斯学派</li>
                    <li id="ra-li">回归分析</li>
                </ul>
            </div>
            <div class="modal-visualization">
                <div id="bp" class="current">
                    <div class="nav-unit-wrapper-s tile1">
                        <img src="../img/tiles/1-1.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 随机事件 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile2">
                        <img src="../img/tiles/1-2.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 期望 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile3">
                        <img src="../img/tiles/1-3.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 方差 </span>
                    </div>
                </div>
                <div id="cp">
                    <div class="nav-unit-wrapper-s tile1">
                        <img src="../img/tiles/2-1.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 集合论 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile2">
                        <img src="../img/tiles/2-2.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 古典概型 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile3">
                        <img src="../img/tiles/2-3.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 条件概率 </span>
                    </div>
                </div>
                <div id="pd">
                    <div class="nav-unit-wrapper-s tile1">
                        <img src="../img/tiles/3-1.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 随机变量 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile2">
                        <img src="../img/tiles/3-2.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 离散型和连续型随机变量 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile3">
                        <img src="../img/tiles/3-3.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 中心极限定理 </span>
                    </div>
                </div>
                <div id="fi" class="current">
                    <div class="nav-unit-wrapper-s tile1">
                        <img src="../img/tiles/4-1.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 点估计理论 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile2">
                        <img src="../img/tiles/4-2.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 置信区间 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile3">
                        <img src="../img/tiles/4-3.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> Bootstrap方法 </span>
                    </div>
                </div>
                <div id="bi">
                    <div class="nav-unit-wrapper-s tile1">
                        <img src="../img/tiles/5-1.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 贝叶斯公式 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile2">
                        <img src="../img/tiles/5-2.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 似然函数 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile3">
                        <img src="../img/tiles/5-3.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 从先验概率到后验概率 </span>
                    </div>
                </div>
                <div id="ra">
                    <div class="nav-unit-wrapper-s tile1">
                        <img src="../img/tiles/6-1.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s">  最小二乘法 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile2">
                        <img src="../img/tiles/6-2.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 相关性 </span>
                    </div>
                    <div class="nav-unit-wrapper-s tile3">
                        <img src="../img/tiles/6-3.png" class="nav-unit-tile-s">
                        <span class="nav-unit-title-s"> 方差分析 </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Share CSS and JavaScript -->
    <link rel="stylesheet" href="../css/share.min.css">
    <script src="../js/jquery.share.min.js"></script>
    <script>
        $('#share').share();

        $(".languageSetting").change(function() {
          var option = $(this).find('option:selected');
          window.location.href = option.data("url");
        });
    </script>

</body>

</html>